<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>png++: io_base.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">png++
   &#160;<span id="projectnumber">0.2.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">io_base.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="io__base_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2007,2008   Alex Shulgin</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This file is part of png++ the C++ wrapper for libpng.  PNG++ is free</span>
<a name="l00005"></a>00005 <span class="comment"> * software; the exact copying conditions are as follows:</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00008"></a>00008 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00011"></a>00011 <span class="comment"> * this list of conditions and the following disclaimer.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00015"></a>00015 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * 3. The name of the author may not be used to endorse or promote products</span>
<a name="l00018"></a>00018 <span class="comment"> * derived from this software without specific prior written permission.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS&#39;&#39; AND ANY EXPRESS OR</span>
<a name="l00021"></a>00021 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
<a name="l00022"></a>00022 <span class="comment"> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN</span>
<a name="l00023"></a>00023 <span class="comment"> * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00024"></a>00024 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED</span>
<a name="l00025"></a>00025 <span class="comment"> * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
<a name="l00026"></a>00026 <span class="comment"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
<a name="l00027"></a>00027 <span class="comment"> * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
<a name="l00028"></a>00028 <span class="comment"> * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00029"></a>00029 <span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef PNGPP_IO_BASE_HPP_INCLUDED</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PNGPP_IO_BASE_HPP_INCLUDED</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;cstdarg&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &quot;<a class="code" href="error_8hpp.html">error.hpp</a>&quot;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &quot;<a class="code" href="info_8hpp.html">info.hpp</a>&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;<a class="code" href="end__info_8hpp.html">end_info.hpp</a>&quot;</span>
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00042"></a>00042 trace_io_transform(<span class="keywordtype">char</span> <span class="keyword">const</span>* fmt, ...)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="preprocessor">#ifdef DEBUG_IO_TRANSFORM</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>    va_list va;
<a name="l00046"></a>00046     va_start(va, fmt);
<a name="l00047"></a>00047     fprintf(stderr, <span class="stringliteral">&quot;TRANSFORM_IO: &quot;</span>);
<a name="l00048"></a>00048     vfprintf(stderr, fmt, va);
<a name="l00049"></a>00049     va_end(va);
<a name="l00050"></a>00050 <span class="preprocessor">#endif</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>}
<a name="l00052"></a>00052 <span class="preprocessor">#define TRACE_IO_TRANSFORM trace_io_transform</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span>
<a name="l00054"></a>00054 <span class="keyword">namespace </span>png
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 
<a name="l00062"></a><a class="code" href="classpng_1_1io__base.html">00062</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>
<a name="l00063"></a>00063     {
<a name="l00064"></a>00064         <a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>(<a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a> <span class="keyword">const</span>&amp;);
<a name="l00065"></a>00065         <a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>&amp; operator=(<a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a> <span class="keyword">const</span>&amp;);
<a name="l00066"></a>00066 
<a name="l00067"></a>00067     <span class="keyword">public</span>:
<a name="l00068"></a><a class="code" href="classpng_1_1io__base.html#a74af9c813a17cd2f62878545cb389c0e">00068</a>         <span class="keyword">explicit</span> <a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>(png_struct* png)
<a name="l00069"></a>00069             : <a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>(png),
<a name="l00070"></a>00070               <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>(*this, <a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>),
<a name="l00071"></a>00071               <a class="code" href="classpng_1_1io__base.html#a4dc235d3aa8764d1a1a73c6d1fefed61">m_end_info</a>(*this, <a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>)
<a name="l00072"></a>00072         {
<a name="l00073"></a>00073         }
<a name="l00074"></a>00074 
<a name="l00075"></a><a class="code" href="classpng_1_1io__base.html#abf29081454d38b8beee5a69761f6e205">00075</a>         <a class="code" href="classpng_1_1io__base.html#abf29081454d38b8beee5a69761f6e205">~io_base</a>()
<a name="l00076"></a>00076         {
<a name="l00077"></a>00077             assert(! <a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00078"></a>00078             assert(! <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1info__base.html#a030a8262a2ef1bf8c97a2eafe71c2f3c">get_png_info</a>());
<a name="l00079"></a>00079             assert(! <a class="code" href="classpng_1_1io__base.html#a4dc235d3aa8764d1a1a73c6d1fefed61">m_end_info</a>.<a class="code" href="classpng_1_1info__base.html#a030a8262a2ef1bf8c97a2eafe71c2f3c">get_png_info</a>());
<a name="l00080"></a>00080         }
<a name="l00081"></a>00081 
<a name="l00082"></a><a class="code" href="classpng_1_1io__base.html#a5d9e331efe0bf92a26c8943f0ffe3a6e">00082</a>         png_struct* <a class="code" href="classpng_1_1io__base.html#a5d9e331efe0bf92a26c8943f0ffe3a6e">get_png_struct</a>()<span class="keyword"> const</span>
<a name="l00083"></a>00083 <span class="keyword">        </span>{
<a name="l00084"></a>00084             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>;
<a name="l00085"></a>00085         }
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="classpng_1_1io__base.html#a18cfaa6714239cf81ecac6565f5d0913">00087</a>         <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>&amp; <a class="code" href="classpng_1_1io__base.html#a18cfaa6714239cf81ecac6565f5d0913">get_info</a>()
<a name="l00088"></a>00088         {
<a name="l00089"></a>00089             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>;
<a name="l00090"></a>00090         }
<a name="l00091"></a>00091 
<a name="l00092"></a><a class="code" href="classpng_1_1io__base.html#aa608ad4c4dd3d11ddf9fc84cfcc93b9e">00092</a>         <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1io__base.html#a18cfaa6714239cf81ecac6565f5d0913">get_info</a>()<span class="keyword"> const</span>
<a name="l00093"></a>00093 <span class="keyword">        </span>{
<a name="l00094"></a>00094             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>;
<a name="l00095"></a>00095         }
<a name="l00096"></a>00096 
<a name="l00097"></a><a class="code" href="classpng_1_1io__base.html#a581297639a9102527d09ab868c16915b">00097</a>         <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1io__base.html#a581297639a9102527d09ab868c16915b">get_image_info</a>()<span class="keyword"> const</span>
<a name="l00098"></a>00098 <span class="keyword">        </span>{
<a name="l00099"></a>00099             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>;
<a name="l00100"></a>00100         }
<a name="l00101"></a>00101 
<a name="l00102"></a><a class="code" href="classpng_1_1io__base.html#a9e2c8aa9dbd7f398758a992c4857ca02">00102</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a9e2c8aa9dbd7f398758a992c4857ca02">set_image_info</a>(<a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>)
<a name="l00103"></a>00103         {
<a name="l00104"></a>00104             <span class="keyword">static_cast&lt;</span> <a class="code" href="classpng_1_1image__info.html" title="Holds information about PNG image.">image_info</a>&amp; <span class="keyword">&gt;</span>(<a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>) = info; <span class="comment">// slice it</span>
<a name="l00105"></a>00105         }
<a name="l00106"></a>00106 
<a name="l00107"></a><a class="code" href="classpng_1_1io__base.html#af535ae840d9436d627ab385d98edc3a0">00107</a>         <a class="code" href="classpng_1_1end__info.html" title="Internal class to hold PNG ending info.">end_info</a>&amp; <a class="code" href="classpng_1_1io__base.html#af535ae840d9436d627ab385d98edc3a0">get_end_info</a>()
<a name="l00108"></a>00108         {
<a name="l00109"></a>00109             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a4dc235d3aa8764d1a1a73c6d1fefed61">m_end_info</a>;
<a name="l00110"></a>00110         }
<a name="l00111"></a>00111 
<a name="l00112"></a><a class="code" href="classpng_1_1io__base.html#a738c4da282f1cf606e4775b86167f20c">00112</a>         <a class="code" href="classpng_1_1end__info.html" title="Internal class to hold PNG ending info.">end_info</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1io__base.html#af535ae840d9436d627ab385d98edc3a0">get_end_info</a>()<span class="keyword"> const</span>
<a name="l00113"></a>00113 <span class="keyword">        </span>{
<a name="l00114"></a>00114             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a4dc235d3aa8764d1a1a73c6d1fefed61">m_end_info</a>;
<a name="l00115"></a>00115         }
<a name="l00116"></a>00116 
<a name="l00118"></a>00118         <span class="comment">// info accessors</span>
<a name="l00119"></a>00119         <span class="comment">//</span>
<a name="l00120"></a><a class="code" href="classpng_1_1io__base.html#ad029fe82abb63a11c158aac299c03693">00120</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1io__base.html#ad029fe82abb63a11c158aac299c03693">get_width</a>()<span class="keyword"> const</span>
<a name="l00121"></a>00121 <span class="keyword">        </span>{
<a name="l00122"></a>00122             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#ac13df5daaabb2219cf1d52c95b1f98c7">get_width</a>();
<a name="l00123"></a>00123         }
<a name="l00124"></a>00124 
<a name="l00125"></a><a class="code" href="classpng_1_1io__base.html#ae4eb810e5e17a14e3d832cb4eb9f1c47">00125</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ae4eb810e5e17a14e3d832cb4eb9f1c47">set_width</a>(<span class="keywordtype">size_t</span> width)
<a name="l00126"></a>00126         {
<a name="l00127"></a>00127             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a3d23fc1552357d39fe4d8d017b9bea0a">set_width</a>(width);
<a name="l00128"></a>00128         }
<a name="l00129"></a>00129 
<a name="l00130"></a><a class="code" href="classpng_1_1io__base.html#a7fc587adfd83110c3e1fe7e91fdd3f52">00130</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1io__base.html#a7fc587adfd83110c3e1fe7e91fdd3f52">get_height</a>()<span class="keyword"> const</span>
<a name="l00131"></a>00131 <span class="keyword">        </span>{
<a name="l00132"></a>00132             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a640f6451351d62920fa2786dea53cd4d">get_height</a>();
<a name="l00133"></a>00133         }
<a name="l00134"></a>00134 
<a name="l00135"></a><a class="code" href="classpng_1_1io__base.html#afe74d4f86852d7374d6137027cc2f0fe">00135</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#afe74d4f86852d7374d6137027cc2f0fe">set_height</a>(<span class="keywordtype">size_t</span> height)
<a name="l00136"></a>00136         {
<a name="l00137"></a>00137             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a6ccb5704bf7f715572a6129bf3009761">set_height</a>(height);
<a name="l00138"></a>00138         }
<a name="l00139"></a>00139 
<a name="l00140"></a><a class="code" href="classpng_1_1io__base.html#ab8070ca679dfb49c226978297e7b4c08">00140</a>         <a class="code" href="namespacepng.html#a4f30149e7da9c8d70e84e6977a7f74da">color_type</a> <a class="code" href="classpng_1_1io__base.html#ab8070ca679dfb49c226978297e7b4c08">get_color_type</a>()<span class="keyword"> const</span>
<a name="l00141"></a>00141 <span class="keyword">        </span>{
<a name="l00142"></a>00142             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a8b8b0e44c44d2071d70c8606c0390854">get_color_type</a>();
<a name="l00143"></a>00143         }
<a name="l00144"></a>00144 
<a name="l00145"></a><a class="code" href="classpng_1_1io__base.html#a513fdbaa4edc5249da2ce8319521b222">00145</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a513fdbaa4edc5249da2ce8319521b222">set_color_type</a>(<a class="code" href="namespacepng.html#a4f30149e7da9c8d70e84e6977a7f74da">color_type</a> color_space)
<a name="l00146"></a>00146         {
<a name="l00147"></a>00147             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a2eb5d253e70b620a1050affd316dfb78">set_color_type</a>(color_space);
<a name="l00148"></a>00148         }
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="classpng_1_1io__base.html#a391152531f1825e81460b9847a3a8000">00150</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1io__base.html#a391152531f1825e81460b9847a3a8000">get_bit_depth</a>()<span class="keyword"> const</span>
<a name="l00151"></a>00151 <span class="keyword">        </span>{
<a name="l00152"></a>00152             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#aa299bb6730c4b68883d7683699dfd035">get_bit_depth</a>();
<a name="l00153"></a>00153         }
<a name="l00154"></a>00154 
<a name="l00155"></a><a class="code" href="classpng_1_1io__base.html#afc85421463d684509709e5efbf5ca7d0">00155</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#afc85421463d684509709e5efbf5ca7d0">set_bit_depth</a>(<span class="keywordtype">size_t</span> bit_depth)
<a name="l00156"></a>00156         {
<a name="l00157"></a>00157             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a1f1cf6197f7d0241d7410916076a6c08">set_bit_depth</a>(bit_depth);
<a name="l00158"></a>00158         }
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="classpng_1_1io__base.html#aafcad747360e4cfbb942e6a9cbe3e8d2">00160</a>         <a class="code" href="namespacepng.html#a4b468278362e4ccf0b2c52f9c0692bdc">interlace_type</a> <a class="code" href="classpng_1_1io__base.html#aafcad747360e4cfbb942e6a9cbe3e8d2">get_interlace_type</a>()<span class="keyword"> const</span>
<a name="l00161"></a>00161 <span class="keyword">        </span>{
<a name="l00162"></a>00162             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#ac43327884ca1d053002cb3ba3ef24188">get_interlace_type</a>();
<a name="l00163"></a>00163         }
<a name="l00164"></a>00164 
<a name="l00165"></a><a class="code" href="classpng_1_1io__base.html#a1d74ab5bf36d6392dc7117e716f3ddb9">00165</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a1d74ab5bf36d6392dc7117e716f3ddb9">set_interlace_type</a>(<a class="code" href="namespacepng.html#a4b468278362e4ccf0b2c52f9c0692bdc">interlace_type</a> interlace)
<a name="l00166"></a>00166         {
<a name="l00167"></a>00167             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a19a24d29c7f47223a8df1164c093361c">set_interlace_type</a>(interlace);
<a name="l00168"></a>00168         }
<a name="l00169"></a>00169 
<a name="l00170"></a><a class="code" href="classpng_1_1io__base.html#a931fd4c0eeb583ccdfea8af368e68373">00170</a>         <a class="code" href="namespacepng.html#a8437714ca563a374d534e5edf57fbab8">compression_type</a> <a class="code" href="classpng_1_1io__base.html#a931fd4c0eeb583ccdfea8af368e68373">get_compression_type</a>()<span class="keyword"> const</span>
<a name="l00171"></a>00171 <span class="keyword">        </span>{
<a name="l00172"></a>00172             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#ae8f5870c3fd31cc3f0cb158c2a20bbcd">get_compression_type</a>();
<a name="l00173"></a>00173         }
<a name="l00174"></a>00174 
<a name="l00175"></a><a class="code" href="classpng_1_1io__base.html#a82f1e2f375a0c6e4e5e984a1822befad">00175</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a82f1e2f375a0c6e4e5e984a1822befad">set_compression_type</a>(<a class="code" href="namespacepng.html#a8437714ca563a374d534e5edf57fbab8">compression_type</a> compression)
<a name="l00176"></a>00176         {
<a name="l00177"></a>00177             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a5a645e38fe10f80ced96301cdb0dec74">set_compression_type</a>(compression);
<a name="l00178"></a>00178         }
<a name="l00179"></a>00179 
<a name="l00180"></a><a class="code" href="classpng_1_1io__base.html#ab591ef5f52d4fcb761cfa05362d25442">00180</a>         <a class="code" href="namespacepng.html#ab65439f6689d3a6742450e55f3e0fbce">filter_type</a> <a class="code" href="classpng_1_1io__base.html#ab591ef5f52d4fcb761cfa05362d25442">get_filter_type</a>()<span class="keyword"> const</span>
<a name="l00181"></a>00181 <span class="keyword">        </span>{
<a name="l00182"></a>00182             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a71305d6b01e0c58838144b01d10bbb14">get_filter_type</a>();
<a name="l00183"></a>00183         }
<a name="l00184"></a>00184 
<a name="l00185"></a><a class="code" href="classpng_1_1io__base.html#a38a20626a77b13a454f2877c562194fa">00185</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a38a20626a77b13a454f2877c562194fa">set_filter_type</a>(<a class="code" href="namespacepng.html#ab65439f6689d3a6742450e55f3e0fbce">filter_type</a> filter)
<a name="l00186"></a>00186         {
<a name="l00187"></a>00187             <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1image__info.html#a886e48b7371f2768acb9fc9768d57366">set_filter_type</a>(filter);
<a name="l00188"></a>00188         }
<a name="l00189"></a>00189 
<a name="l00191"></a>00191 
<a name="l00192"></a><a class="code" href="classpng_1_1io__base.html#a183571c721c9da3eebe056877e1b84ff">00192</a>         <span class="keywordtype">bool</span> <a class="code" href="classpng_1_1io__base.html#a183571c721c9da3eebe056877e1b84ff">has_chunk</a>(<a class="code" href="namespacepng.html#a93bd423c4b470bcea62b3664e835ec87">chunk</a> <span class="keywordtype">id</span>)
<a name="l00193"></a>00193         {
<a name="l00194"></a>00194             <span class="keywordflow">return</span> png_get_valid(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>,
<a name="l00195"></a>00195                                  <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>.<a class="code" href="classpng_1_1info__base.html#a030a8262a2ef1bf8c97a2eafe71c2f3c">get_png_info</a>(),
<a name="l00196"></a>00196                                  <a class="code" href="namespacepng.html#a76064164adfdd2316adebf0a4fb83873">uint_32</a>(<span class="keywordtype">id</span>)) == <a class="code" href="namespacepng.html#a76064164adfdd2316adebf0a4fb83873">uint_32</a>(<span class="keywordtype">id</span>);
<a name="l00197"></a>00197         }
<a name="l00198"></a>00198 
<a name="l00199"></a>00199 <span class="preprocessor">#if defined(PNG_READ_EXPAND_SUPPORTED)</span>
<a name="l00200"></a><a class="code" href="classpng_1_1io__base.html#ab33730e38ea2fe21c59557df6ad7d78b">00200</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ab33730e38ea2fe21c59557df6ad7d78b">set_gray_1_2_4_to_8</a>()<span class="keyword"> const</span>
<a name="l00201"></a>00201 <span class="keyword">        </span>{
<a name="l00202"></a>00202             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_expand_gray_1_2_4_to_8\n&quot;</span>);
<a name="l00203"></a>00203             png_set_expand_gray_1_2_4_to_8(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00204"></a>00204         }
<a name="l00205"></a>00205 
<a name="l00206"></a><a class="code" href="classpng_1_1io__base.html#a551d63cd2c32d66d8ecdb5b50061fed6">00206</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a551d63cd2c32d66d8ecdb5b50061fed6">set_palette_to_rgb</a>()<span class="keyword"> const</span>
<a name="l00207"></a>00207 <span class="keyword">        </span>{
<a name="l00208"></a>00208             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_palette_to_rgb\n&quot;</span>);
<a name="l00209"></a>00209             png_set_palette_to_rgb(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00210"></a>00210         }
<a name="l00211"></a>00211 
<a name="l00212"></a><a class="code" href="classpng_1_1io__base.html#a43bc25cb81b37fecf4851fcf6ebb26ce">00212</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a43bc25cb81b37fecf4851fcf6ebb26ce">set_tRNS_to_alpha</a>()<span class="keyword"> const</span>
<a name="l00213"></a>00213 <span class="keyword">        </span>{
<a name="l00214"></a>00214             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_tRNS_to_alpha\n&quot;</span>);
<a name="l00215"></a>00215             png_set_tRNS_to_alpha(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00216"></a>00216         }
<a name="l00217"></a>00217 <span class="preprocessor">#endif // defined(PNG_READ_EXPAND_SUPPORTED)</span>
<a name="l00218"></a>00218 <span class="preprocessor"></span>
<a name="l00219"></a>00219 <span class="preprocessor">#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)</span>
<a name="l00220"></a><a class="code" href="classpng_1_1io__base.html#a7e3f205c2a44d3ebd32664efc031608d">00220</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a7e3f205c2a44d3ebd32664efc031608d">set_bgr</a>()<span class="keyword"> const</span>
<a name="l00221"></a>00221 <span class="keyword">        </span>{
<a name="l00222"></a>00222             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_bgr\n&quot;</span>);
<a name="l00223"></a>00223             png_set_bgr(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00224"></a>00224         }
<a name="l00225"></a>00225 <span class="preprocessor">#endif</span>
<a name="l00226"></a>00226 <span class="preprocessor"></span>
<a name="l00227"></a>00227 <span class="preprocessor">#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)</span>
<a name="l00228"></a><a class="code" href="classpng_1_1io__base.html#aeec721b9743dd97861377a44e0a4c999">00228</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#aeec721b9743dd97861377a44e0a4c999">set_gray_to_rgb</a>()<span class="keyword"> const</span>
<a name="l00229"></a>00229 <span class="keyword">        </span>{
<a name="l00230"></a>00230             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_gray_to_rgb\n&quot;</span>);
<a name="l00231"></a>00231             png_set_gray_to_rgb(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00232"></a>00232         }
<a name="l00233"></a>00233 <span class="preprocessor">#endif</span>
<a name="l00234"></a>00234 <span class="preprocessor"></span>
<a name="l00235"></a>00235 <span class="preprocessor">#ifdef PNG_FLOATING_POINT_SUPPORTED</span>
<a name="l00236"></a><a class="code" href="classpng_1_1io__base.html#a8e9771d816eee5d3f39f3c1486130525">00236</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a8e9771d816eee5d3f39f3c1486130525">set_rgb_to_gray</a>(<a class="code" href="namespacepng.html#a451e56cd3bd185a771be5fbeb0647cd6">rgb_to_gray_error_action</a> error_action
<a name="l00237"></a>00237                              = <a class="code" href="namespacepng.html#a451e56cd3bd185a771be5fbeb0647cd6a2ccd117106c8dc2c306a28a0f5990ed6">rgb_to_gray_silent</a>,
<a name="l00238"></a>00238                              <span class="keywordtype">double</span> red_weight   = -1.0,
<a name="l00239"></a>00239                              <span class="keywordtype">double</span> green_weight = -1.0)<span class="keyword"> const</span>
<a name="l00240"></a>00240 <span class="keyword">        </span>{
<a name="l00241"></a>00241             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_rgb_to_gray: error_action=%d,&quot;</span>
<a name="l00242"></a>00242                                <span class="stringliteral">&quot; red_weight=%lf, green_weight=%lf\n&quot;</span>,
<a name="l00243"></a>00243                                error_action, red_weight, green_weight);
<a name="l00244"></a>00244 
<a name="l00245"></a>00245             png_set_rgb_to_gray(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, error_action, red_weight, green_weight);
<a name="l00246"></a>00246         }
<a name="l00247"></a>00247 <span class="preprocessor">#else</span>
<a name="l00248"></a><a class="code" href="classpng_1_1io__base.html#a44c058b968732d972b496c89d9327033">00248</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a8e9771d816eee5d3f39f3c1486130525">set_rgb_to_gray</a>(<a class="code" href="namespacepng.html#a451e56cd3bd185a771be5fbeb0647cd6">rgb_to_gray_error_action</a> error_action
<a name="l00249"></a>00249                              = <a class="code" href="namespacepng.html#a451e56cd3bd185a771be5fbeb0647cd6a2ccd117106c8dc2c306a28a0f5990ed6">rgb_to_gray_silent</a>,
<a name="l00250"></a>00250                              <a class="code" href="namespacepng.html#a4c959f5dcf74dffe1567f7e0c9a4cf65">fixed_point</a> red_weight   = -1,
<a name="l00251"></a>00251                              <a class="code" href="namespacepng.html#a4c959f5dcf74dffe1567f7e0c9a4cf65">fixed_point</a> green_weight = -1)<span class="keyword"> const</span>
<a name="l00252"></a>00252 <span class="keyword">        </span>{
<a name="l00253"></a>00253             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_rgb_to_gray_fixed: error_action=%d,&quot;</span>
<a name="l00254"></a>00254                                <span class="stringliteral">&quot; red_weight=%d, green_weight=%d\n&quot;</span>,
<a name="l00255"></a>00255                                error_action, red_weight, green_weight);
<a name="l00256"></a>00256 
<a name="l00257"></a>00257             png_set_rgb_to_gray_fixed(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, error_action,
<a name="l00258"></a>00258                                       red_weight, green_weight);
<a name="l00259"></a>00259         }
<a name="l00260"></a>00260 <span class="preprocessor">#endif // PNG_FLOATING_POINT_SUPPORTED</span>
<a name="l00261"></a>00261 <span class="preprocessor"></span>
<a name="l00263"></a>00263         <span class="comment">// alpha channel transformations</span>
<a name="l00264"></a>00264         <span class="comment">//</span>
<a name="l00265"></a>00265 <span class="preprocessor">#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)</span>
<a name="l00266"></a><a class="code" href="classpng_1_1io__base.html#ab1c8dc7c170befd8a12c4bb286a91295">00266</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ab1c8dc7c170befd8a12c4bb286a91295">set_strip_alpha</a>()<span class="keyword"> const</span>
<a name="l00267"></a>00267 <span class="keyword">        </span>{
<a name="l00268"></a>00268             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_strip_alpha\n&quot;</span>);
<a name="l00269"></a>00269             png_set_strip_alpha(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00270"></a>00270         }
<a name="l00271"></a>00271 <span class="preprocessor">#endif</span>
<a name="l00272"></a>00272 <span class="preprocessor"></span>
<a name="l00273"></a>00273 <span class="preprocessor">#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) \</span>
<a name="l00274"></a>00274 <span class="preprocessor">    || defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)</span>
<a name="l00275"></a><a class="code" href="classpng_1_1io__base.html#adddd63fc26893097fcaeda7c0595e162">00275</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#adddd63fc26893097fcaeda7c0595e162">set_swap_alpha</a>()<span class="keyword"> const</span>
<a name="l00276"></a>00276 <span class="keyword">        </span>{
<a name="l00277"></a>00277             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_swap_alpha\n&quot;</span>);
<a name="l00278"></a>00278             png_set_swap_alpha(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00279"></a>00279         }
<a name="l00280"></a>00280 <span class="preprocessor">#endif</span>
<a name="l00281"></a>00281 <span class="preprocessor"></span>
<a name="l00282"></a>00282 <span class="preprocessor">#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) \</span>
<a name="l00283"></a>00283 <span class="preprocessor">    || defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)</span>
<a name="l00284"></a><a class="code" href="classpng_1_1io__base.html#a435d99ee19964274642f7e6106feacdb">00284</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a435d99ee19964274642f7e6106feacdb">set_invert_alpha</a>()<span class="keyword"> const</span>
<a name="l00285"></a>00285 <span class="keyword">        </span>{
<a name="l00286"></a>00286             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_invert_alpha\n&quot;</span>);
<a name="l00287"></a>00287             png_set_invert_alpha(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00288"></a>00288         }
<a name="l00289"></a>00289 <span class="preprocessor">#endif</span>
<a name="l00290"></a>00290 <span class="preprocessor"></span>
<a name="l00291"></a>00291 <span class="preprocessor">#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)</span>
<a name="l00292"></a><a class="code" href="classpng_1_1io__base.html#ac261464930a122a9b53f2b464229f81d">00292</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ac261464930a122a9b53f2b464229f81d">set_filler</a>(<a class="code" href="namespacepng.html#a76064164adfdd2316adebf0a4fb83873">uint_32</a> filler, <a class="code" href="namespacepng.html#a45c793e9e2229e38e935486c95962fe4">filler_type</a> type)<span class="keyword"> const</span>
<a name="l00293"></a>00293 <span class="keyword">        </span>{
<a name="l00294"></a>00294             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_filler: filler=%08x, type=%d\n&quot;</span>,
<a name="l00295"></a>00295                                filler, type);
<a name="l00296"></a>00296 
<a name="l00297"></a>00297             png_set_filler(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, filler, type);
<a name="l00298"></a>00298         }
<a name="l00299"></a>00299 
<a name="l00300"></a>00300 <span class="preprocessor">#if !defined(PNG_1_0_X)</span>
<a name="l00301"></a><a class="code" href="classpng_1_1io__base.html#a20d77b4fe7e6232a383455bd021e569e">00301</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a20d77b4fe7e6232a383455bd021e569e">set_add_alpha</a>(<a class="code" href="namespacepng.html#a76064164adfdd2316adebf0a4fb83873">uint_32</a> filler, <a class="code" href="namespacepng.html#a45c793e9e2229e38e935486c95962fe4">filler_type</a> type)<span class="keyword"> const</span>
<a name="l00302"></a>00302 <span class="keyword">        </span>{
<a name="l00303"></a>00303             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_add_alpha: filler=%08x, type=%d\n&quot;</span>,
<a name="l00304"></a>00304                                filler, type);
<a name="l00305"></a>00305 
<a name="l00306"></a>00306             png_set_add_alpha(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, filler, type);
<a name="l00307"></a>00307         }
<a name="l00308"></a>00308 <span class="preprocessor">#endif</span>
<a name="l00309"></a>00309 <span class="preprocessor"></span><span class="preprocessor">#endif // PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED</span>
<a name="l00310"></a>00310 <span class="preprocessor"></span>
<a name="l00311"></a>00311 <span class="preprocessor">#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)</span>
<a name="l00312"></a><a class="code" href="classpng_1_1io__base.html#ae937edb8117961235667f808a3f88e3e">00312</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ae937edb8117961235667f808a3f88e3e">set_swap</a>()<span class="keyword"> const</span>
<a name="l00313"></a>00313 <span class="keyword">        </span>{
<a name="l00314"></a>00314             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_swap\n&quot;</span>);
<a name="l00315"></a>00315             png_set_swap(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00316"></a>00316         }
<a name="l00317"></a>00317 <span class="preprocessor">#endif</span>
<a name="l00318"></a>00318 <span class="preprocessor"></span>
<a name="l00319"></a>00319 <span class="preprocessor">#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)</span>
<a name="l00320"></a><a class="code" href="classpng_1_1io__base.html#a9c32bcead1438c8699de660fc328e54b">00320</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a9c32bcead1438c8699de660fc328e54b">set_packing</a>()<span class="keyword"> const</span>
<a name="l00321"></a>00321 <span class="keyword">        </span>{
<a name="l00322"></a>00322             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_packing\n&quot;</span>);
<a name="l00323"></a>00323             png_set_packing(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00324"></a>00324         }
<a name="l00325"></a>00325 <span class="preprocessor">#endif</span>
<a name="l00326"></a>00326 <span class="preprocessor"></span>
<a name="l00327"></a>00327 <span class="preprocessor">#if defined(PNG_READ_PACKSWAP_SUPPORTED) \</span>
<a name="l00328"></a>00328 <span class="preprocessor">    || defined(PNG_WRITE_PACKSWAP_SUPPORTED)</span>
<a name="l00329"></a><a class="code" href="classpng_1_1io__base.html#afd3fc19a106b1e53afedc2032a373d87">00329</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#afd3fc19a106b1e53afedc2032a373d87">set_packswap</a>()<span class="keyword"> const</span>
<a name="l00330"></a>00330 <span class="keyword">        </span>{
<a name="l00331"></a>00331             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_packswap\n&quot;</span>);
<a name="l00332"></a>00332             png_set_packswap(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00333"></a>00333         }
<a name="l00334"></a>00334 <span class="preprocessor">#endif</span>
<a name="l00335"></a>00335 <span class="preprocessor"></span>
<a name="l00336"></a>00336 <span class="preprocessor">#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)</span>
<a name="l00337"></a><a class="code" href="classpng_1_1io__base.html#af902d001731492a24814bddf71aebb95">00337</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#af902d001731492a24814bddf71aebb95">set_shift</a>(<a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> red_bits, <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> green_bits, <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> blue_bits,
<a name="l00338"></a>00338                        <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> alpha_bits = 0)<span class="keyword"> const</span>
<a name="l00339"></a>00339 <span class="keyword">        </span>{
<a name="l00340"></a>00340             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_shift: red_bits=%d, green_bits=%d,&quot;</span>
<a name="l00341"></a>00341                                <span class="stringliteral">&quot; blue_bits=%d, alpha_bits=%d\n&quot;</span>,
<a name="l00342"></a>00342                                red_bits, green_bits, blue_bits, alpha_bits);
<a name="l00343"></a>00343 
<a name="l00344"></a>00344             <span class="keywordflow">if</span> (<a class="code" href="classpng_1_1io__base.html#ab8070ca679dfb49c226978297e7b4c08">get_color_type</a>() != <a class="code" href="namespacepng.html#a4f30149e7da9c8d70e84e6977a7f74daac1c6d97fe7c6ffdcefb0a85b2c40f84e">color_type_rgb</a>
<a name="l00345"></a>00345                 || <a class="code" href="classpng_1_1io__base.html#ab8070ca679dfb49c226978297e7b4c08">get_color_type</a>() != <a class="code" href="namespacepng.html#a4f30149e7da9c8d70e84e6977a7f74daa80549eb488fbe42737b3c19412a06e78">color_type_rgb_alpha</a>)
<a name="l00346"></a>00346             {
<a name="l00347"></a>00347                 <span class="keywordflow">throw</span> <a class="code" href="classpng_1_1error.html" title="Exception class to represent runtime errors related to png++ operation.">error</a>(<span class="stringliteral">&quot;set_shift: expected RGB or RGBA color type&quot;</span>);
<a name="l00348"></a>00348             }
<a name="l00349"></a>00349             <a class="code" href="namespacepng.html#a99fd8ae78b964f14f567ee72cd2d6b5b">color_info</a> bits;
<a name="l00350"></a>00350             bits.red = red_bits;
<a name="l00351"></a>00351             bits.green = green_bits;
<a name="l00352"></a>00352             bits.blue = blue_bits;
<a name="l00353"></a>00353             bits.alpha = alpha_bits;
<a name="l00354"></a>00354             png_set_shift(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, &amp; bits);
<a name="l00355"></a>00355         }
<a name="l00356"></a>00356 
<a name="l00357"></a><a class="code" href="classpng_1_1io__base.html#a78d01257bb71a6e3fb7da0ed50a72fc3">00357</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#af902d001731492a24814bddf71aebb95">set_shift</a>(<a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> gray_bits, <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> alpha_bits = 0)<span class="keyword"> const</span>
<a name="l00358"></a>00358 <span class="keyword">        </span>{
<a name="l00359"></a>00359             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_shift: gray_bits=%d, alpha_bits=%d\n&quot;</span>,
<a name="l00360"></a>00360                                gray_bits, alpha_bits);
<a name="l00361"></a>00361 
<a name="l00362"></a>00362             <span class="keywordflow">if</span> (<a class="code" href="classpng_1_1io__base.html#ab8070ca679dfb49c226978297e7b4c08">get_color_type</a>() != <a class="code" href="namespacepng.html#a4f30149e7da9c8d70e84e6977a7f74daa0c175d7c5fff3387508ad5cbb7fc456c">color_type_gray</a>
<a name="l00363"></a>00363                 || <a class="code" href="classpng_1_1io__base.html#ab8070ca679dfb49c226978297e7b4c08">get_color_type</a>() != <a class="code" href="namespacepng.html#a4f30149e7da9c8d70e84e6977a7f74daac6d2c13a7b31bec53b4ebba5cceed9a1">color_type_gray_alpha</a>)
<a name="l00364"></a>00364             {
<a name="l00365"></a>00365                 <span class="keywordflow">throw</span> <a class="code" href="classpng_1_1error.html" title="Exception class to represent runtime errors related to png++ operation.">error</a>(<span class="stringliteral">&quot;set_shift: expected Gray or Gray+Alpha&quot;</span>
<a name="l00366"></a>00366                             <span class="stringliteral">&quot; color type&quot;</span>);
<a name="l00367"></a>00367             }
<a name="l00368"></a>00368             <a class="code" href="namespacepng.html#a99fd8ae78b964f14f567ee72cd2d6b5b">color_info</a> bits;
<a name="l00369"></a>00369             bits.gray = gray_bits;
<a name="l00370"></a>00370             bits.alpha = alpha_bits;
<a name="l00371"></a>00371             png_set_shift(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, &amp; bits);
<a name="l00372"></a>00372         }
<a name="l00373"></a>00373 <span class="preprocessor">#endif // PNG_READ_SHIFT_SUPPORTED || PNG_WRITE_SHIFT_SUPPORTED</span>
<a name="l00374"></a>00374 <span class="preprocessor"></span>
<a name="l00375"></a>00375 <span class="preprocessor">#if defined(PNG_READ_INTERLACING_SUPPORTED) \</span>
<a name="l00376"></a>00376 <span class="preprocessor">    || defined(PNG_WRITE_INTERLACING_SUPPORTED)</span>
<a name="l00377"></a><a class="code" href="classpng_1_1io__base.html#acdb6c2fe9e68f6ce2643131a21999279">00377</a> <span class="preprocessor"></span>        <span class="keywordtype">int</span> <a class="code" href="classpng_1_1io__base.html#acdb6c2fe9e68f6ce2643131a21999279">set_interlace_handling</a>()<span class="keyword"> const</span>
<a name="l00378"></a>00378 <span class="keyword">        </span>{
<a name="l00379"></a>00379             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_interlace_handling\n&quot;</span>);
<a name="l00380"></a>00380             <span class="keywordflow">return</span> png_set_interlace_handling(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00381"></a>00381         }
<a name="l00382"></a>00382 <span class="preprocessor">#endif</span>
<a name="l00383"></a>00383 <span class="preprocessor"></span>
<a name="l00384"></a>00384 <span class="preprocessor">#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)</span>
<a name="l00385"></a><a class="code" href="classpng_1_1io__base.html#ad26dd1169cba0fc6f82a081c960ee476">00385</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ad26dd1169cba0fc6f82a081c960ee476">set_invert_mono</a>()<span class="keyword"> const</span>
<a name="l00386"></a>00386 <span class="keyword">        </span>{
<a name="l00387"></a>00387             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_invert_mono\n&quot;</span>);
<a name="l00388"></a>00388             png_set_invert_mono(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00389"></a>00389         }
<a name="l00390"></a>00390 <span class="preprocessor">#endif</span>
<a name="l00391"></a>00391 <span class="preprocessor"></span>
<a name="l00392"></a>00392 <span class="preprocessor">#if defined(PNG_READ_16_TO_8_SUPPORTED)</span>
<a name="l00393"></a><a class="code" href="classpng_1_1io__base.html#ad801a397266597a8f64f3a983cc9c866">00393</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ad801a397266597a8f64f3a983cc9c866">set_strip_16</a>()<span class="keyword"> const</span>
<a name="l00394"></a>00394 <span class="keyword">        </span>{
<a name="l00395"></a>00395             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_strip_16\n&quot;</span>);
<a name="l00396"></a>00396             png_set_strip_16(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00397"></a>00397         }
<a name="l00398"></a>00398 <span class="preprocessor">#endif</span>
<a name="l00399"></a>00399 <span class="preprocessor"></span>
<a name="l00400"></a>00400 <span class="preprocessor">#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)</span>
<a name="l00401"></a><a class="code" href="classpng_1_1io__base.html#ad4798a1cabbd2d6956184e154de0e7bd">00401</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ad4798a1cabbd2d6956184e154de0e7bd">set_read_user_transform</a>(png_user_transform_ptr transform_fn)
<a name="l00402"></a>00402         {
<a name="l00403"></a>00403             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_read_user_transform_fn\n&quot;</span>);
<a name="l00404"></a>00404             png_set_read_user_transform_fn(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, transform_fn);
<a name="l00405"></a>00405         }
<a name="l00406"></a>00406 <span class="preprocessor">#endif</span>
<a name="l00407"></a>00407 <span class="preprocessor"></span>
<a name="l00408"></a>00408 <span class="preprocessor">#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) \</span>
<a name="l00409"></a>00409 <span class="preprocessor">    || defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)</span>
<a name="l00410"></a><a class="code" href="classpng_1_1io__base.html#abf283c5d396276f539597ae1922ea61d">00410</a> <span class="preprocessor"></span>        <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#abf283c5d396276f539597ae1922ea61d">set_user_transform_info</a>(<span class="keywordtype">void</span>* <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a>, <span class="keywordtype">int</span> bit_depth, <span class="keywordtype">int</span> channels)
<a name="l00411"></a>00411         {
<a name="l00412"></a>00412             TRACE_IO_TRANSFORM(<span class="stringliteral">&quot;png_set_user_transform_info: bit_depth=%d,&quot;</span>
<a name="l00413"></a>00413                                <span class="stringliteral">&quot; channels=%d\n&quot;</span>, bit_depth, channels);
<a name="l00414"></a>00414 
<a name="l00415"></a>00415             png_set_user_transform_info(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>, info, bit_depth, channels);
<a name="l00416"></a>00416         }
<a name="l00417"></a>00417 <span class="preprocessor">#endif</span>
<a name="l00418"></a>00418 <span class="preprocessor"></span>
<a name="l00419"></a>00419     <span class="keyword">protected</span>:
<a name="l00420"></a><a class="code" href="classpng_1_1io__base.html#a96514f5448d6a51682f435eee7dc790e">00420</a>         <span class="keywordtype">void</span>* <a class="code" href="classpng_1_1io__base.html#a96514f5448d6a51682f435eee7dc790e">get_io_ptr</a>()<span class="keyword"> const</span>
<a name="l00421"></a>00421 <span class="keyword">        </span>{
<a name="l00422"></a>00422             <span class="keywordflow">return</span> png_get_io_ptr(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>);
<a name="l00423"></a>00423         }
<a name="l00424"></a>00424 
<a name="l00425"></a><a class="code" href="classpng_1_1io__base.html#a39065eb7d408ba2c251d381095dade8a">00425</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#a39065eb7d408ba2c251d381095dade8a">set_error</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* message)
<a name="l00426"></a>00426         {
<a name="l00427"></a>00427             assert(message);
<a name="l00428"></a>00428             <a class="code" href="classpng_1_1io__base.html#a0525d690575be17366b555672bac823e">m_error</a> = message;
<a name="l00429"></a>00429         }
<a name="l00430"></a>00430 
<a name="l00431"></a><a class="code" href="classpng_1_1io__base.html#afba999be609454b12e2cd4ef3ca9a3f2">00431</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#afba999be609454b12e2cd4ef3ca9a3f2">reset_error</a>()
<a name="l00432"></a>00432         {
<a name="l00433"></a>00433             <a class="code" href="classpng_1_1io__base.html#a0525d690575be17366b555672bac823e">m_error</a>.clear();
<a name="l00434"></a>00434         }
<a name="l00435"></a>00435 
<a name="l00436"></a>00436 <span class="comment">/*</span>
<a name="l00437"></a>00437 <span class="comment">        std::string const&amp; get_error() const</span>
<a name="l00438"></a>00438 <span class="comment">        {</span>
<a name="l00439"></a>00439 <span class="comment">            return m_error;</span>
<a name="l00440"></a>00440 <span class="comment">        }</span>
<a name="l00441"></a>00441 <span class="comment">*/</span>
<a name="l00442"></a>00442 
<a name="l00443"></a><a class="code" href="classpng_1_1io__base.html#a4bfbb79bd63e35d54339f15baade71f5">00443</a>         <span class="keywordtype">bool</span> <a class="code" href="classpng_1_1io__base.html#a4bfbb79bd63e35d54339f15baade71f5">is_error</a>()<span class="keyword"> const</span>
<a name="l00444"></a>00444 <span class="keyword">        </span>{
<a name="l00445"></a>00445             <span class="keywordflow">return</span> !<a class="code" href="classpng_1_1io__base.html#a0525d690575be17366b555672bac823e">m_error</a>.empty();
<a name="l00446"></a>00446         }
<a name="l00447"></a>00447 
<a name="l00448"></a><a class="code" href="classpng_1_1io__base.html#ad01b0dbb31b81fe9d6de1d9ff2f2136e">00448</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ad01b0dbb31b81fe9d6de1d9ff2f2136e">raise_error</a>()
<a name="l00449"></a>00449         {
<a name="l00450"></a>00450             longjmp(png_jmpbuf(<a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>), -1);
<a name="l00451"></a>00451         }
<a name="l00452"></a>00452 
<a name="l00453"></a><a class="code" href="classpng_1_1io__base.html#a4601208d1fe621240e14be76e8f82904">00453</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classpng_1_1io__base.html#ad01b0dbb31b81fe9d6de1d9ff2f2136e">raise_error</a>(png_struct* png, <span class="keywordtype">char</span> <span class="keyword">const</span>* message)
<a name="l00454"></a>00454         {
<a name="l00455"></a>00455             <a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>* io = <span class="keyword">static_cast&lt;</span> <a class="code" href="classpng_1_1io__base.html" title="Base class for PNG reader/writer classes.">io_base</a>* <span class="keyword">&gt;</span>(png_get_error_ptr(png));
<a name="l00456"></a>00456             io-&gt;<a class="code" href="classpng_1_1io__base.html#a39065eb7d408ba2c251d381095dade8a">set_error</a>(message);
<a name="l00457"></a>00457             io-&gt;<a class="code" href="classpng_1_1io__base.html#ad01b0dbb31b81fe9d6de1d9ff2f2136e">raise_error</a>();
<a name="l00458"></a>00458         }
<a name="l00459"></a>00459 
<a name="l00460"></a><a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">00460</a>         png_struct* <a class="code" href="classpng_1_1io__base.html#a343eb5ab2ad984e7020d8489b64ec9d2">m_png</a>;
<a name="l00461"></a><a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">00461</a>         <a class="code" href="classpng_1_1info.html" title="Holds information about PNG image. Adapter class for IO image operations.">info</a> <a class="code" href="classpng_1_1io__base.html#a3253298a348305da3f3b6cf38f201300">m_info</a>;
<a name="l00462"></a><a class="code" href="classpng_1_1io__base.html#a4dc235d3aa8764d1a1a73c6d1fefed61">00462</a>         <a class="code" href="classpng_1_1end__info.html" title="Internal class to hold PNG ending info.">end_info</a> <a class="code" href="classpng_1_1io__base.html#a4dc235d3aa8764d1a1a73c6d1fefed61">m_end_info</a>;
<a name="l00463"></a><a class="code" href="classpng_1_1io__base.html#a0525d690575be17366b555672bac823e">00463</a>         std::string <a class="code" href="classpng_1_1io__base.html#a0525d690575be17366b555672bac823e">m_error</a>;
<a name="l00464"></a>00464     };
<a name="l00465"></a>00465 
<a name="l00466"></a>00466 } <span class="comment">// namespace png</span>
<a name="l00467"></a>00467 
<a name="l00468"></a>00468 <span class="preprocessor">#endif // PNGPP_IO_BASE_HPP_INCLUDED</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Jan 25 2013 14:10:10 for png++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
